<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>流动边框</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .box {
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        width: 180px;
        height: 260px;
        border-radius: 8px;
        margin: 100px auto;
        background-color: #d6e4ff;
        overflow: hidden;
      }
      .box::before {
        content: "";
        position: absolute;
        width: 40%;
        height: 200%;
        background: linear-gradient(#03fcc6, #ff0296);
        animation: rotates 4s linear infinite;
      }
      @keyframes rotates {
        to {
          transform: rotate(360deg);
        }
      }
      .box-container {
        position: absolute;
        border-radius: 8px;
        inset: 3px;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        background-color: #fff;
        z-index: 999;
      }
      .box-container > div {
        color: red;
        text-align: center;
        font-size: 40px;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
          "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
          "Helvetica Neue", sans-serif;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="box-container">
        <div>新春</div>
        <div>快乐</div>
      </div>
    </div>
  </body>
</html>
